﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Logica;
using Entidades1;

namespace WebSisVet1.Account
{
    public partial class RegHistoriaClinica : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
             //1.txtCedula.Text = Request.QueryString["Cedula"].ToString();
            if (Session["codigoh"] != null)
            {

                //if (Session["bd"] == "postgre") { Radio.Checked = true; } else if (Session["bd"] == "oracle") { ridioO.Checked = true; } else { Radio1.Checked = true; };

                hdOper.Value = "act";
                txtCodigoH.Text = Session["codigoh"].ToString();
                txtIdMascota.Text = Session["idmascota"].ToString();
                txtIdVeterinario.Text = Session["idveterinario"].ToString();
                txtFecha.Text = Session["fecha"].ToString();
                txtIdServicio.Text = Session["idservicio"].ToString();

                //buscar el ctacto especifico
                //mostrarlo
                Session["bd"] = null;
                Session["codigoh"] = null;
            }
            else
            {

                hdOper.Value = "new";

            }
        }

        protected void BtnGuardar_Click(object sender, EventArgs e)
        {
            HistoriaClinicaBLL hbll = new HistoriaClinicaBLL();
            HistoriaClinica h = new HistoriaClinica();
            h.codigoH = txtCodigoH.Text;
            h.idMascota = txtIdMascota.Text;
            h.idVeterinario = txtIdVeterinario.Text;
            h.fecha = txtFecha.Text;
            h.idServicio = txtIdServicio.Text;
            //if (Radio1.Checked) { c.bd = "mysql"; };
            //if (Radio.Checked) { c.bd = "postgre"; };
            //if (ridioO.Checked) { c.bd = "oracle"; };
            lbMsg.Text = hbll.Agregar(h);


        }
        protected void BtnActualizar_Click(object sender, EventArgs e)
        {
           HistoriaClinicaBLL hbll = new HistoriaClinicaBLL();
            HistoriaClinica h = new HistoriaClinica();
            h.codigoH = txtCodigoH.Text;
            h.idMascota = txtIdMascota.Text;
            h.idVeterinario = txtIdVeterinario.Text;
            h.fecha = txtFecha.Text;
            h.idServicio = txtIdServicio.Text;
            //if (Radio1.Checked) { c.bd = "mysql"; };
            //if (Radio.Checked) { c.bd = "postgre"; };
            //if (ridioO.Checked) { c.bd = "oracle"; };
            lbMsg.Text = hbll.Agregar(h);


        }


        protected void BtnVolver_Click(object sender, EventArgs e)
        {
            Response.Redirect("~/GestionHistoriaClinica.aspx");
        }

        public char s { get; set; }
    }
}